package rudia.org.database;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RudiaDao {

	@Autowired
	private SqlSession dao;

	protected RudiaDao() {
		// PMD abstract Rule
		// - If the class is intended to be used as a base class only (not to be
		// instantiated directly)
		// a protected constructor can be provided prevent direct instantiation
	}

	/*insert*/
	protected Object insert(String queryId) {
		return dao.insert(queryId);
	}

	protected Object insert(String queryId, Object parameterObject) {
		return dao.insert(queryId, parameterObject);
	}

	/*update*/
	protected int update(String queryId) {
		return dao.update(queryId);
	}

	protected int update(String queryId, Object parameterObject) {
		return dao.update(queryId, parameterObject);
	}

	/*delete*/
	protected int delete(String queryId) {
		return dao.delete(queryId);
	}

	protected int delete(String queryId, Object parameterObject) {
		return dao.delete(queryId, parameterObject);
	}

	/*select*/
	protected Object selectOne(String queryId) {
		return dao.selectOne(queryId);
	}

	protected Object selectOne(String queryId, Object parameterObject) {
		return dao.selectOne(queryId, parameterObject);
	}
	
	/*select*/
	protected Object select(String queryId) {
		return dao.selectList(queryId);
	}
	
	protected Object select(String queryId, Object parameterObject) {
		return dao.selectList(queryId, parameterObject);
	}

	protected void commit() {
		dao.commit();
	}

}
